
<?php
require 'connection.php';
$type=$_GET['type'];
$query = mysql_query("SELECT * FROM gallery where type='".$type."'")
or die('Error');

if(mysql_num_rows($query) > 0) {?>
	<table><tr>
	<?php 
	$temp=0;
	while($r = mysql_fetch_assoc($query)) {
		if($temp==4){
		echo '<tr>';
		$temp=0;
		}
	?>		
			<td><a href="images/gallery/<?php echo $r['title']?>" data-lightbox="roadtrip">
			<img src="images/gallery/<?php echo $r['title']?>" class="image_frame_100"></a><br>
			</td>
		
	<?php 
	if($temp==4){
		echo '</tr>';
		$temp=0;
	}
	$temp++;
	}?>
	</tr>
	</table>
	<?php 
	mysql_close();
}else{
	echo '<h1>Es gibt keine Bilder in dieser Galerie</h1>';
}
?>
